import React, { Component } from "react";

// 类组件接收插槽的方式
class Child extends Component {
  state = {};
  render() {
    console.log(this);
    return <div>child组件 - {this.props.children}</div>;
  }
}

const Child2 = (props) => {
  return <div>child2组件 - {props.children}</div>;
};

class App extends Component {
  render() {
    return (
      <>
        <h2>插槽</h2>
        <Child>
          <span>123</span>
        </Child>
        <Child2>
          <span>456</span>
        </Child2>
      </>
    );
  }
}

export default App;
